package com.alibaba.sdk.model.input;

import com.alibaba.sdk.enums.UserTypeEnum;
import com.alibaba.sdk.model.BaseInput;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 用户新增参数类
 *
 * @author huangTT(bluehtt @ gmail.com)
 * @author Shawn (Shawn_0108@163.com)
 * @version 1.0
 * @date 2020/6/4
 */
@ApiModel(description = "用户新增参数类")
@Data
public class UserAddInput extends BaseInput {

    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名。由数字和字母组成，长度2-20位", required = true)
    @Pattern(regexp = "[0-9a-zA-Z]+", message = "用户名由字母或者数字组成")
    @NotBlank(message = "用户名不能为空")
    @Size(min = 2, max = 20, message = "用户名长度范围2-20位")
    private String username;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码", required = true)
    @NotBlank(message = "密码不能为空。长度范围6-15位")
    @Size(min = 6, max = 15, message = "密码长度范围6-15位")
    private String password;

    /**
     * 姓名
     */
    @ApiModelProperty(value = "姓名", required = true)
    @NotBlank(message = "姓名不能为空")
    private String name;

    /**
     * 联系方式
     */
    @ApiModelProperty(value = "联系方式", required = true)
    @NotBlank(message = "联系方式不能为空")
    private String phone;

    /**
     * 用户类型
     */
    @ApiModelProperty(value = "用户类型。1：超级管理员，2：管理员，3：普通用户", required = true, example = "3")
    @NotNull(message = "用户类型code传入错误")
    private UserTypeEnum userType;

    private static final long serialVersionUID = 3970626469725559779L;
}
